-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement packing local variable and constant data on 64-bit if stack usage is high #156
Conversation
Signed-off-by: Seonghyun Kim <[email protected]>
Signed-off-by: Seonghyun Kim <[email protected]>
@@ -347,7 +347,7 @@ if (f.type == Type::B) { puts("failed in msvc."); } | |||
std::unique_ptr<uint8_t[]> Result##HolderWhenUsingMalloc; \ | |||
size_t bytes##Result = (Bytes); \ | |||
Type* Result; \ | |||
if (LIKELY(bytes##Result < 512)) { \ | |||
if (LIKELY(bytes##Result < 2048)) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any special reason for increasing the size of alloca?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code generated by emcc sometimes uses stack a lot.
src/parser/WASMParser.cpp
Outdated
// put already aligned variables first | ||
for (size_t i = m_currentFunctionType->param().size(); i < m_localInfo.size(); i++) { | ||
auto& info = m_localInfo[i]; | ||
if (Walrus::hasCPUWordAlingedSize(info.m_valueType) || needsCPUWordAlingedAddress(info.m_valueType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a typo Alinged
-> Aligned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops!
case Value::FuncRef: | ||
case Value::ExternRef: | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little bit confused, do these FuncRef and ExternRef need alignment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arm devices cannot support unaligned pointer well :(
https://embeddedartistry.com/blog/2016/12/26/arm-pointer-alignment-requirements/
- if we want to use bdwgc later, we need to align pointer in stack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then what about 32bit platform?
This patch marks alignment only for addresses in 64bit platform, but I think that this alignment needs to be applied for 32bit addresses too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we don't consider alignment of 32-bit platform
Every value contents have multiple of 4-byte size and
and we have experience that alloca function returns aligned address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I get it :)
Packing approach has this issue only for 64bit platform
… usage is high Signed-off-by: Seonghyun Kim <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.